<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/15
 * Time: 22:09
 */

namespace App\Library\form_builder\src\components;
use App\Library\form_builder\View;

class Input extends BaseForm
{
    /**
     * @var string
     */
    protected $name = 'input';

    /**
     * 组件类型
     */
    const TYPE_TEXT = 'text';
    /**
     *
     */
    const TYPE_PASSWORD = 'password';
    /**
     *
     */
    const TYPE_TEXTAREA = 'textarea';
    /**
     *
     */
    const TYPE_URL = 'url';
    /**
     *
     */
    const TYPE_EMAIL = 'email';
    /**
     *
     */
    const TYPE_DATE = 'date';
    /**
     * 组件类型
     */
    const TYPE_HIDDEN = 'hidden';
    protected $type='text';
    /**
     * @param $type
     */
    public function type($type){
        $this->type=$type;
    }
    /**
     * 生成组件
     *
     * @return array
     */

    public function build()
    {
        return [
            'type' => $this->type,
            'field' => $this->field,
            'title' => $this->title,
            'value' => $this->values,
            'props' => $this->props,
            'validate' => $this->valids,
        ];
    }
}